Skip to content

feat(vba): type VBA call receivers through globals, factories and chains - #348

Merged
ardelperal merged 2 commits into
mainfrom
feat/vba-receiver-typing
Nov 30, 2026
Merged

ardelperal merged 2 commits into
mainfrom
feat/vba-receiver-typing

Conversation

@ardelperal

Copy link
Copy Markdown
Owner

Closes #345. Ports the logic of upstream's VB.NET receiver typing to the VBA extractor and resolver.

New receiver shapes

  • A Public variable of a standard module used from other files (gObj.Member, With gObj). Only in files with Option Explicit, and never for a name a parameter or local shadows.
  • Set x = Factory() where the factory declares its return type, in another file.
  • Me.Field.Member and typed module fields.
  • Chain hops through a Property Get / Function return type or a public field: a.Hijo.IDCalc → Otra.IDCalc, With a.Hijo, With .Hijo inside a typed With.
  • Fail closed: with a known type, only Type.Member is linked. Zero or several candidates, a primitive, Object, a qualified type or an array mean no edge. For Each is not typed (VBA collections have no element type).
  • Combined with fix(vba): case-insensitive failed-reference retry on incremental sync #346, a type that differs only in case (As EXPEDIENTE vs class Expediente) also resolves.

Evidence

  • 11 new tests (RED 4 → GREEN 11). The VBA and sync subsets pass after integrating fix(vba): case-insensitive failed-reference retry on incremental sync #346 (109 files, 1556 tests). tsc is clean.
  • AGEDYS edge diff against 3.1.0 (with fix(vba): case-insensitive failed-reference retry on incremental sync #346 merged): 31 lost and 357 gained, all calls.
    • Each of the 31 lost edges was a dead-end stub, and each has a replacement from the same caller to the same member on the real class (checked by script).
    • The 357 gained break down as: 191 member reads through module globals (m_ObjEntorno.X), 27 Set writes, chain hops, Me.Field/Me.Prop reads, and 51 reads on receivers declared in another case (Dim m_Expediente As EXPEDIENTE → Expediente.RistraResponsables). Samples were checked by grep.
    • No edge reaches a wrong class.
  • The full suite was not run locally (machine contention); CI on Node 22 is the authoritative run.

Known limits

Ports the logic of upstream's VB.NET receiver typing to VBA:
- Public variables of standard modules used from other files (only in
  files with Option Explicit, never a shadowed name)
- Set x = Factory() where Factory declares its return type
- Me.Field.Member and typed module fields
- chain hops through a Property Get / Function return type or a public
  field (a.Hijo.IDCalc -> Otra.IDCalc), including With a.Hijo and
  With .Hijo inside a typed With
- with a known receiver type only that class's member is linked; zero or
  several candidates, primitives, Object or arrays fail closed

For Each has no element type in VBA and is not typed.

Closes #345
Combines #345's typed-receiver resolution with #346's case-insensitive
VBA lookup: the by-name step delegates to resolveVbaQualifiedTarget, and
typed member lookups use it too, so a receiver declared As EXPEDIENTE
reaches class Expediente.
@ardelperal
ardelperal merged commit 1ef4c36 into main Nov 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(vba): receiver typing for VBA calls (port of upstream VB.NET receivers)

1 participant